# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=autogen
pkgver=5.18.4
pkgrel=2
pkgdesc="A tool designed to simplify the creation and maintenance of programs that contain large amounts of repetitious text"
arch=('i686' 'x86_64')
url="http://autogen.sourceforge.net/"
groups=('base-devel')
license=('GPL3')
makedepends=('gcc' 'gmp-devel' 'libcrypt-devel' 'libffi-devel' 'libgc-devel' 'libguile-devel' 'libxml2-devel')
depends=('gcc-libs' 'gmp' 'libcrypt' 'libffi' 'libgc' 'libguile' 'libxml2')
install=autogen.install
source=("http://ftp.gnu.org/gnu/${pkgname}/rel${pkgver}/${pkgname}-${pkgver}.tar.xz"{,.sig}
        autogen-5.18.1-msys2.patch)
sha256sums=('7fbaff0c25035aee5b96913de2c83d9a5cc973b8dc08d6b7489ecbcfd72eb84b'
            'SKIP'
            'd4bfc04d85a1995ddd8e5c6a3c5b65504a4ef42b74e4c6416865e54cc188d52a')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"
  patch -p1 -i ${srcdir}/autogen-5.18.1-msys2.patch

  autoreconf -i
}

build() {
  LDFLAGS+=' -Wl,--export-all-symbols'
  cd "$srcdir/$pkgname-$pkgver"
  ./configure \
    --build=${CHOST} \
    --host=${CHOST} \
    --prefix=/usr
  make all
}

check() {
  cd "$srcdir/$pkgname-$pkgver"
  #make -k check
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install
  mv $pkgdir/usr/share/pkgconfig $pkgdir/usr/lib/
}
